<?php
if(!isset($dbselect)) //前面没设置 数据库 则指定使用 DB3
    $dbselect   = Db::G3();
///关于标收费信息的统计
$sfwhere      = "";
if($startdate!="" && $enddate!=""){
    $sfwheref    = " and subscribe_time>='$startdate' and  subscribe_time<='$enddate'"; 
    $sfwheres    = " and btime>='$startdate' and  btime<='$enddate'"; 
} 
$gfiledf        = "SUBSTR(subscribe_time,1,10 )";
if($MOD=="M"){
    $gfiledf    = "SUBSTR(subscribe_time,1,7)";    
}
$gfileds        = "SUBSTR(btime,1,10 )";
if($MOD=="M"){
    $gfileds    = "SUBSTR(btime,1,7)";    
}  
$rows = $dbselect->GetRows("SELECT $gfiledf '关注时间',count(subscribe) AS '关注数'
FROM 09wx_u_info
WHERE subscribe=1 $sfwheref
GROUP BY $gfiledf ");
foreach($rows as &$row)
{   
    $ctime  = $row['关注时间'];
    $count  = $row['关注数'];
    CTLog::G()->pxxDayReal($count.",sid",1,"微信_关注_新增",$count,$ctime);
}
$rows = $dbselect->GetRows("SELECT $gfileds '绑定时间',count(subscribe) AS '绑定数'
FROM 09wx_u_info
WHERE subscribe=1 $sfwheres
GROUP BY $gfileds ");
foreach($rows as &$row)
{   
    $ctime  = $row['绑定时间'];
    $count  = $row['绑定数'];
    CTLog::G()->pxxDayReal($count.",sid",1,"微信_绑定_新增",$count,$ctime);
}

///总数


if($startdate!="" && $enddate!=""){
    $sfwheref    = " and subscribe_time<='$enddate'"; 
    $sfwheres    = " and btime<='$enddate'"; 
} 
$rows = $dbselect->GetRows("SELECT $gfiledf '关注时间',count(subscribe) AS '关注数'
FROM 09wx_u_info
WHERE subscribe=1 $sfwheref
GROUP BY $gfiledf ");
foreach($rows as &$row)
{   
    $ctime  = $row['关注时间'];
    $count  = $row['关注数'];
    CTLog::G()->pxxDayReal($count.",sid",1,"微信_关注_总",$count,$ctime);
}

$rows = $dbselect->GetRows("SELECT $gfiledf '绑定时间',count(subscribe) AS '绑定数'
FROM 09wx_u_info
WHERE subscribe=1 $sfwheres
GROUP BY $gfileds ");
foreach($rows as &$row)
{   
    $ctime  = $row['绑定时间'];
    $count  = $row['绑定数'];
    CTLog::G()->pxxDayReal($count.",sid",1,"微信_绑定_总",$count,$ctime);
}